package com.service.device;

import com.common.ErrorCodeEnum;
import com.common.emums.DataStatus;
import com.common.exception.BusinessException;
import com.common.utils.StringUtils;
import com.core.springSecurity.common.SecurityUtils;

import com.dao.secondary.device.DeviceObdWorkDailyRecordInfoMapper;
import com.github.pagehelper.Page;
import com.model.domain.device.GetDeviceObdWorkDailyRecordInfoDO;
import com.model.pojo.device.DeviceObdWorkDailyRecordInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;


/**
 * @Author: zql
 * @Description: obd作业日报统计信息服务
 * @Data: 2023-07-06
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DeviceObdWorkDailyRecordInfoService {
    private final DeviceObdWorkDailyRecordInfoMapper deviceObdWorkDailyRecordInfoMapper;

    public List<DeviceObdWorkDailyRecordInfo> getPageList(GetDeviceObdWorkDailyRecordInfoDO getDeviceObdWorkDailyRecordInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getDeviceObdWorkDailyRecordInfoDO.getPage(),getDeviceObdWorkDailyRecordInfoDO.getPageSize(),getDeviceObdWorkDailyRecordInfoDO.getSortRow()+getDeviceObdWorkDailyRecordInfoDO.getSortOrder());
        return deviceObdWorkDailyRecordInfoMapper.selectList(getDeviceObdWorkDailyRecordInfoDO);
    }

    public List<DeviceObdWorkDailyRecordInfo> getAllList(GetDeviceObdWorkDailyRecordInfoDO getDeviceObdWorkDailyRecordInfoDO){
        PageHelper.clearPage();
        PageHelper.orderBy(getDeviceObdWorkDailyRecordInfoDO.getSortRow()+getDeviceObdWorkDailyRecordInfoDO.getSortOrder());
        return deviceObdWorkDailyRecordInfoMapper.selectList(getDeviceObdWorkDailyRecordInfoDO);
    }

    public List<Map<String,Object>> getOnLineDataInDay(GetDeviceObdWorkDailyRecordInfoDO getdeviceObdWorkDailyRecordInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getdeviceObdWorkDailyRecordInfoDO.getPage(),getdeviceObdWorkDailyRecordInfoDO.getPageSize(),getdeviceObdWorkDailyRecordInfoDO.getSortRow()+getdeviceObdWorkDailyRecordInfoDO.getSortOrder());
        return deviceObdWorkDailyRecordInfoMapper.selectOnLineDataInDay(getdeviceObdWorkDailyRecordInfoDO);
    }
}
